home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / demos.idb / usr / demos / Demo_Interfaces / Buttonfly / demofind.z / demofind
Encoding:
Text File  |  1997-06-26  |  1.7 KB  |  78 lines

  1. #!/usr/sbin/perl
  2.  
  3. # Grab the base script
  4. require "/usr/demos/Demo_Interfaces/Web/cgi-scripts/DEMO_base.cgi";
  5.  
  6. # Colors
  7. $color = ".9 .5 .9";
  8. $highcolor = "1.0 .7 1.0";
  9.  
  10.  
  11.  
  12.  
  13. &list;
  14. &search;
  15.  
  16.  
  17. sub search {
  18.     # This is a script that finds demos
  19.     open(CMD, "/usr/sbin/slaunch -m \"Please enter search string:\"|");
  20.     read(CMD, $query, 100);
  21.     close(CMD);
  22.     chop $query;
  23.     foreach $num ( 0 .. $#demos ) {
  24.         if ( "$query" eq "$demos[$num]" ) {
  25.             chdir("$basedir/General_Demos");
  26.             opendir(DIR, "$basedir/General_Demos/$query");
  27.             if(grep(/\.m_.*/, readdir(DIR))) {
  28.                 $execute = "$basedir/Demo_Interfaces/Buttonfly/mkmenu related $query";
  29.                 $type = "top";
  30.             } else {
  31.                 $execute = "$basedir/General_Demos/$query/RUN";
  32.                 $type = "bottom";
  33.             }
  34.             close(DIR);
  35.             print "$query\n";
  36.             print "\t.cd. $basedir/General_Demos/$query\n";
  37.             print "\t$execute\n";
  38.             if ( "$type" eq "top" ) {
  39.                 print "\t.menu. -\n";
  40.                 print "\t.popup. $query %t\n";
  41.                 print "\t.color. $color\n";
  42.                 print "\t.highcolor. $highcolor\n";
  43.             } else {
  44.                 print "\t.popup. $query %t\n";
  45.                 print "\t.popup. Manual\n";
  46.                 print "\t$basedir/Demo_Interfaces/Buttonfly/mkmenu man $query\n";
  47.                 print "\t.popup. Information\n";
  48.                 print "\t$basedir/Demo_Interfaces/Buttonfly/mkmenu info $query\n";
  49.             }
  50.             $state = "good";
  51.         }
  52.     }
  53.     
  54.     
  55.     if (!$state) {
  56.         open(CMD, "/usr/bin/X11/xconfirm -header \"Find a Demo\" -B OK -b Search -icon info -t \"Demo not found: $query\"|");
  57.         read(CMD, $ans, 100);
  58.         close(CMD);
  59.         chop $ans;    
  60.  
  61.         if ( "$ans" eq "Search" ) {
  62.             &search;
  63.         }
  64.         
  65.     }
  66.  
  67. }
  68.  
  69.  
  70. sub list {
  71.     chdir("$basedir");
  72.     opendir(DIR, "$basedir/General_Demos");
  73.     @demos = (grep(!/^\.\.?$/, readdir(DIR)));
  74.     closedir(DIR);
  75.     @demos = sort @demos;
  76.     return(@demos);
  77. }
  78.